
package com.wisdom.smartbook.utils;


import android.annotation.SuppressLint;
import android.webkit.JavascriptInterface;

/**
 * @ClassName: AndroidtoJs
 * @Author: 刘小军
 * @CreateDate: 2023/6/14 7:14 下午
 * @Version: 6.1.7
 * @Description: java类作用描述
 */
@SuppressLint("JavascriptInterface")
public class AndroidtoJs extends Object {

    AndJSBridge mAndJSBridge;

    public AndroidtoJs(AndJSBridge bridge) {
        mAndJSBridge = bridge;
    }


    //
    // 打开登录弹窗
    @SuppressLint("JavascriptInterface")
    @JavascriptInterface
    public void login() {
        mAndJSBridge.openLogin();
//        KLog.d("JavascriptInterface   login() ");
    }

    @JavascriptInterface
    public void loginTip(int code, String tip) {
        mAndJSBridge.loginTip(code, tip);
    }

    // 关闭登录弹窗
    @SuppressLint("JavascriptInterface")

    @JavascriptInterface
    public void logout() {
        mAndJSBridge.logout();
    }

    //这个必须加，否则不能调用
    @SuppressLint("JavascriptInterface")

    @JavascriptInterface
    public void appUpdate(int upgradeId, String updateInfo) {
        KLog.d("版本升级 " + "upgradeId=" + upgradeId + " " + updateInfo);
        mAndJSBridge.appUpdate(upgradeId, updateInfo);
    }


    // 打开登录弹窗
    @SuppressLint("JavascriptInterface")
    @JavascriptInterface
    public void loginSuccess() {
        mAndJSBridge.loginSuccess();
    }

    // 打开登录弹窗
    @SuppressLint("JavascriptInterface")
    @JavascriptInterface
    public void downloadFile(String name, String fileUrl, String format) {
        mAndJSBridge.downloadFile(name, fileUrl, format);
    }

    // 打开登录弹窗
    @SuppressLint("JavascriptInterface")
    @JavascriptInterface
    public void openCamera() {
        mAndJSBridge.openCamera();
    }


}